package my.twitter.client;

import java.util.Collection;

import org.json.JSONException;
import org.json.JSONObject;

public class TwitterRequest {

    private Collection<String> followIDs;

    private Collection<String> trackKeywords;

    public Collection<String> getFollowIDs() {
	return followIDs;
    }

    public void setFollowIDs(Collection<String> followIDs) {
	this.followIDs = followIDs;
    }

    public Collection<String> getTrackKeywords() {
	return trackKeywords;
    }

    public void setTrackKeywords(Collection<String> trackKeywords) {
	this.trackKeywords = trackKeywords;
    }

    public String getRequestBody() throws JSONException {
	if (followIDs.isEmpty() && trackKeywords.isEmpty())
	    throw new JSONException("Empty content in Request");

	JSONObject json = new JSONObject();
	for (String followID : followIDs)
	    json.accumulate("follow", followID);
	for (String trackKeyword : trackKeywords)
	    json.accumulate("track", trackKeyword);
	return json.toString();
    }
}
